﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ElfTyping.Animations;

namespace ElfTyping.States.StoryState
{
    public class SetHappinessAction : StoryAction
    {
        bool IsHappy;
        bool IsLeft;

        public SetHappinessAction(StoryState storyState, bool isHappy, bool isLeft)
            : base(storyState)
        {
            IsHappy = isHappy;
            IsLeft = isLeft;
        }

        public override void OnEnd()
        {
            if (IsLeft)
            {
                StoryState.LeftCharacter.IsHappy = IsHappy;

                if (StoryState.LeftCharacterPortrait is FireEmblemPortraitAnimation) {
                    ((FireEmblemPortraitAnimation)StoryState.LeftCharacterPortrait).IsHappy = IsHappy;
                }
            }
            else
            {
                StoryState.RightCharacter.IsHappy = IsHappy;

                if (StoryState.RightCharacterPortrait is FireEmblemPortraitAnimation)
                {
                    ((FireEmblemPortraitAnimation)StoryState.RightCharacterPortrait).IsHappy = IsHappy;
                }
            }

            base.OnEnd();
        }
    }
}
